package lxy;

import java.util.*;

public class Workt6 {
    public static void main(String[] args) {
//        StringBuffer s = new StringBuffer();
//        s.append("电视机,洗衣机,冰箱,彩电,手机");
//        Scanner sc = new Scanner(System.in);
//        System.out.println(s);
//        System.out.println("输入：");
//        String str = sc.next();
//        int f = 0;
//        if ((f = s.indexOf(str)) != -1){
//            s.delete(f,str.length()+1);
//        }
//        s.append("," + str);
//        System.out.println(s);
        String str = new String("电视机,洗衣机,冰箱,彩电,手机");
        String[] split = str.split(",");
        List list = Arrays.asList(split);
        LinkedList<String> link = new LinkedList(list);
        System.out.println(link);
        Scanner sc = new Scanner(System.in);
        System.out.print("输入：");
        String s = sc.next();
        link.remove(s);
        link.addLast(s);
        System.out.println(link);
    }
}
